package cn.lcsjsxy.yxz.day.Set;

import java.util.concurrent.ArrayBlockingQueue;

//Queue
public class Queue1 {

    public static void main(String[] args) throws Exception {

        //
        ArrayBlockingQueue queue = new ArrayBlockingQueue(3);
//        queue.add("1");
//        queue.add("2");
//        queue.add("3");
//        queue.add("4");

//        queue.put(1);
//        System.out.println("第一");
//        queue.put(2);
//        System.out.println("第二");
//        queue.put(3);
//        System.out.println("第三");
//        queue.put(4);
//        System.out.println("第四");

        boolean xiaoming = queue.offer("1");
        System.out.println(xiaoming);
        boolean xiaoliang = queue.offer("2");
        System.out.println(xiaoliang);
        boolean xiaoguang = queue.offer("3");
        System.out.println(xiaoguang);
        boolean xiaoting = queue.offer("4");
        System.out.println(xiaoting);

//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());

        System.out.println(queue);

    }

}
